Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_AHRS: avoid unecessary work in update_orientation #11742

Conversation

peterbarker
Copy link
Contributor

No description provided.

So we can detect transitions from uninitialised to anything else
This method is called at 10Hz by several vehicles.

We do a chunk of work in here when doing a custom orientation -
pointless if the orientation hasn't actually changed since last time we
were called.
@@ -229,7 +229,14 @@ void AP_AHRS::add_trim(float roll_in_radians, float pitch_in_radians, bool save_
// Set the board mounting orientation, may be called while disarmed
void AP_AHRS::update_orientation()
{
const enum Rotation orientation = (enum Rotation)_board_orientation.get();
const Rotation orientation = (enum Rotation)_board_orientation.get();
if (last_orientation == orientation) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks any changes to the orientation on the custom orientation, and would need to be done inside the first if block on line 240.

@peterbarker
Copy link
Contributor Author

Of marginal utility if we have to check the custom-rotation vector. Killing it.

@peterbarker peterbarker closed this Jul 9, 2019
@peterbarker peterbarker deleted the pr/change-ahrs-orientation-remember branch July 9, 2019 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants